package com.gzk.oeno.business.compare;

import java.util.Comparator;

import com.gzk.oeno.business.INamed;

public class NameComparator implements Comparator<INamed>{

	@Override
	public int compare(INamed o1, INamed o2) {
		if (o1 == null && o2 == null)
			return 0;
		if (o1 == null)
			return 1;
		if (o2 == null)
			return -1;
		if (o1.getName() == null && o2.getName() == null)
			return 0;
		if (o1.getName() == null)
			return 1;
		if (o2.getName() == null)
			return -1;
		return o1.getName().compareToIgnoreCase(o2.getName());
	}

}
